﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;

namespace GradeService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IGradeService
    {
        // TODO: Add your service operations here
        [OperationContract]
        GradeBook getGradeBookByUsername(String username, String semester_code);

        [OperationContract]
        GradeBook getGradeBookById(String user_id, String semester_code);

        [OperationContract]
        float calculateOverallGPA(String user_id);

        [OperationContract]
        float calculateSemsterGPA(String user_id, String semester_code);
    }


    [DataContract]
    public class TestScore
    {
        String _testId;
        String _score;
        String _studentId;

        [DataMember]
        public String TestId
        {
            get { return _testId; }
            set { _testId = value; }
        }

        [DataMember]
        public String Score
        {
            get { return _score; }
            set { _score = value; }
        }

        [DataMember]
        public String StudentId
        {
            get { return _studentId; }
            set { _studentId = value; }
        }
    }

    [DataContract]
    public class GradeBook
    {
        List<TestScore> _scores;
        String _studentName;

        [DataMember]
        public List<TestScore> TestScores
        {
            get { return _scores; }
            set { _scores = value; }
        }

        [DataMember]
        public String StudentName
        {
            get { return _studentName; }
            set { _studentName = value; }
        }
    }
}
